package org.ala.tiktools.generator.mybatis.creator.entity.fields;

import org.ala.tiktools.generator.mybatis.config.info.Part;
import org.ala.tiktools.generator.mybatis.creator.entity.EntityInfo;
import org.ala.tiktools.generator.mybatis.creator.entity.FieldInfo;
import org.ala.tiktools.generator.mybatis.dbinfo.TableInfo;
import org.ala.tiktools.generator.mybatis.tools.Tools;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ala
 * @date 2025-03-17 11:12
 */
public class EntityFieldsInfo implements Serializable {
    protected String pkg;
    protected String className;
    protected EntityInfo e;
    protected TableInfo t;
    protected List<FieldInfo> fields;

    protected List<String> imports = new ArrayList<>();

    public static EntityFieldsInfo build(Part p, EntityInfo e, TableInfo t) {
        EntityFieldsInfo f = new EntityFieldsInfo();
        f.pkg = e.getPkg();
        f.className = Tools.upHump(t.getName()) + "Fields";

        f.e = e;
        f.t = t;
        f.fields = e.getFields();

        f.imports.add("java.io.Serializable");
        f.imports.add("java.util.List");
        f.imports.add("java.util.ArrayList");
        return f;
    }

    public String getPkg() {
        return pkg;
    }

    public void setPkg(String pkg) {
        this.pkg = pkg;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public EntityInfo getE() {
        return e;
    }

    public void setE(EntityInfo e) {
        this.e = e;
    }

    public TableInfo getT() {
        return t;
    }

    public void setT(TableInfo t) {
        this.t = t;
    }

    public List<FieldInfo> getFields() {
        return fields;
    }

    public void setFields(List<FieldInfo> fields) {
        this.fields = fields;
    }

    public List<String> getImports() {
        return imports;
    }

    public void setImports(List<String> imports) {
        this.imports = imports;
    }
}
